layui.use('table', function(){
    var table = layui.table;
    //方法级渲染
    var tabins = table.render({
        elem: '#LAY_table_user'
        ,url: '/webapp/file/pageList'
        ,cols: [[
            {field:'name', title: '用户名', width:200}
            ,{field:'money', title: '贷款', width:150, sort: true}
            ,{field:'money', title: '存入保证金', width:150}
            ,{field:'money', title: '代理履约风险金', width:150}
            ,{field:'money', title: '合格证随车履约风险金', width:150}
            ,{field:'date', title: '日期', width:120}
            ,{field:'mailbox', title: '接收邮箱', width:300}
        ]]
        ,id: 'testReload'
        ,page: true
        ,done:function(res){
        }
    });

    var $ = layui.$, active = {
        reload: function(){
            var demoReload = $('#demoReload');

            //执行重载
            table.reload('testReload', {
                page: {
                    curr: 1 //重新从第 1 页开始
                }
                ,where: {
                    key: {
                        id: demoReload.val()
                    }
                }
            });
        }
    };
    $('.demoTable .layui-btn').on('click', function(){
        search = $('#demoReload').val();
        $('.layui-table-fixed tbody tr').each(function(i){
            var id = $(this).children('td').eq(1).children('div').html();
            if(id.indexOf(search)>=0){
                $(this).show()
                $('.layui-table-main tbody tr').eq(i).show()
            }else{
                $('.layui-table-main tbody tr').eq(i).hide()
                $(this).hide();
            }
        });
    });

});
